<?php

namespace app\admin\model;

use think\Model;


class ClothmakingCustomer extends Model
{





    // 表名
    protected $name = 'clothmaking_customer';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'payment_text'
    ];



    public function getPaymentList()
    {
        return [
            'transfer' => '银行转账',
            'cash' => '现金',
            'honour' => '承兑',
            'check' => '支票',
            'thirty' => '30天账期',
            'sixty' => '60天账期'
        ];
    }


    public function getPaymentTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['payment']) ? $data['payment'] : '');
        $list = $this->getPaymentList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
